package design_patterns.proxy.entity;

import design_patterns.proxy.Image;

/**
 * @author chengz
 * @description description
 * @create 2020-08-18 10:06
 */
public class ProxyImage implements Image {
    private RealImage realImage;
    private String fileName;

    public ProxyImage(String fileName) {
        this.fileName = fileName;
    }

    @Override
    public void display() {
        if(realImage==null){
            realImage=new RealImage(fileName);
        }
        realImage.display();
    }
}
